package com.wwmz.mebatis.v1.config;

/**
 * Created by wumz on 2020/10/14 15:09
 */
public class MySqlSession {

    private MyConfiguration configuration;

    private MyExecutor executor;

    public MySqlSession(MyConfiguration configuration, MyExecutor executor){
        this.configuration = configuration;
        this.executor = executor;
    }

    public <T> T seletOne(String statementId, Object param){
        //这里处理statementId
        String sql = MyConfiguration.sqlMappings.getString(statementId);
        if (null != sql && !"".equals(sql)) return executor.query(sql, param);
        return null;
    }


    public <T> T getMapper(Class<T> clazz){
        return configuration.getMapper(clazz, this);
    }
}
